// 重新连接
function restartSSH(ip,user,name,apiport,outport,term) {
    term.clear()
    term.writeln("重连中……")
    sshstatus = outport - 1
    $.post(
        "http://127.0.0.1:1111/main", {
            "cmd":"stop",
            "apiport":apiport,"outport":outport,"sshstatus":sshstatus
        },function (data){
                $.post(
                    "http://127.0.0.1:1111/main", {
                        "cmd":"start",
                        "ip":ip,
                        "user":user,
                        "name":name,"size":100,"timeout":7200,"apiport":apiport,"outport":outport
                    },function (data){
                        if (data === '200'){
                            term.writeln("连接成功!")
                        }
                    }
                );
                console.log(apiport+","+outport+","+sshstatus+data)
                location.reload();
        }
    ).fail(function (){
        //第二次重连时start请求未发送 尼玛的大半夜加个延时就可以了
        // 启动进程
        setTimeout(function(){
            $.post(
                "http://127.0.0.1:1111/main", {
                    "cmd":"start",
                    "ip":ip,
                    "user":user,
                    "name":name,"size":100,"timeout":7200,"apiport":apiport,"outport":outport
                },function (data){
                    if (data === '200'){
                        term.writeln("连接成功!")
                    }
                }
            );
            console.log(apiport+","+outport+","+sshstatus)
            location.reload();
        },3000)
    });

}